package org.shijiagen.product.controller;

import lombok.RequiredArgsConstructor;
import org.shijiagen.param.ProductCollectParam;
import org.shijiagen.pojo.Product;
import org.shijiagen.product.service.ProductService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("product")
@RequiredArgsConstructor
public class ProductCollectController {

    private final ProductService productService;

    @PostMapping("collect/list")
    public List<Product> productListByIds(@RequestBody @Validated ProductCollectParam productCollectParam){
        return productService.productListByIds(productCollectParam.getProductIds());
    }
}
